package com.dxjy.demo.utils.page;

import com.github.pagehelper.PageInfo;

public class PageUtils {

	/**
	 * 将分页信息封装到统一的接口
	 *
	 * @param pageNum
	 * @param pageSize
	 * @param pageInfo
	 * @return
	 */
	public static PageResult getPageResult(Integer pageNum, Integer pageSize, PageInfo<?> pageInfo) {
		PageResult pageResult = new PageResult();
		pageResult.setPageNum(pageInfo.getPageNum());
		pageResult.setPageSize(pageInfo.getPageSize());
		pageResult.setTotalSize(pageInfo.getTotal());
		pageResult.setTotalPages(pageInfo.getPages());
		pageResult.setList(pageInfo.getList());
		return pageResult;
	}
}
